<template>
	<view class="content" :style="{background:'#F7F7F7;'}">
		<text class="font30" v-if="showTitle" :style="{color:'#111111;','margin-bottom':'29rpx;'}">已中奖</text>
		<block v-for="(item, index) in luttery_list" :key="index">
			<view class="other" :style="{background:'#FFFFFF;'}" @click="goToOpenPrize(item.prizedraw_id)">
				<text class="font30" :style="{color:'#111111;'}">奖品：{{item.goods[0].name}}*{{item.goods[0].num}}份</text>
				<!-- <view class="other-right">
					<text class="" :style="{color:'#AEAEAE;'}">2/21</text>
					<image class="" src="../../../static/neck-bload.png" mode=""></image>
				</view> -->
			</view>
		</block>
	</view>
</template>

<script>
	var util = require('@/js/util.js')
	export default {
		data() {
			return {
				luttery_list:[],
				page:1,
				size:20
			};
		},
		onShow() {
			this.getSuccessLuttery()
		},
<<<<<<< HEAD
		computed:{
			showTitle(){
				return this.luttery_list.length >0 ? true :false
			}
=======
		onReachBottom() {
			this.page ++
			this.getSuccessLuttery()
>>>>>>> 263842a02420c7090936b7737331a37d9618b572
		},
		methods:{
			getSuccessLuttery(){
				let _self = this
				uni.request({
					url: util.getUrl("prizedraw/joinLog"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
						win_status:1,
						page:_self.page,
						size:_self.size,
						status:2
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							if(_self.page == 1){
								if(res.data.data.length<=0){
									uni.showToast({
										title:'暂无更多信息！',
										icon:'none'
									})
								}else{
									_self.luttery_list = res.data.data
								}
							}else if(res.data.data.length <=0){
								this.page --
								uni.showToast({
									title:'暂无更多信息！',
									icon:'none'
								})
							}else{
								for(let key in res.data.data){
									_self.luttery_list.push(res.data.data[key])
								}
							}
						}else{
							uni.showToast({
								title:res.data.msg,
								icon:'none'
							})
						}
					},
				});
			},
			goToOpenPrize(id){
				uni.navigateTo({
					url:'openLutteryInfo?id='+id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.other{
		width: 690upx;
		border-radius: 20upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		box-sizing: border-box;
		padding: 32upx 35upx;
		margin-bottom: 30upx;
		.other-right{
			display: flex;
			align-items: center;
			image{
				width: 20upx;
				height: 31upx;
				margin-left: 20upx;
			}
		}
	}
	.content{
		width: 750upx;
		box-sizing: border-box;
		padding: 30upx;
		display: flex;
		align-items: center;
		flex-direction: column;
		min-height: 100vh;
	}
</style>
